<%--
  Created by IntelliJ IDEA.
  User: cherishy
  Date: 2020/7/31
  Time: 19:52
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Register</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/registerStyle.css">
    <link href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="register-page">
    <div class="form">
        <form action="${pageContext.request.contextPath}/user/register" method="post">
            <div class="form-group">
                <label for="userName">用户名</label>
                <input type="text" class="form-control" id="userName" name="userName"><span id="userNameMsg"></span>
            </div>
            <div class="form-group">
                <label for="password">密码</label>
                <input type="password" class="form-control" id="password" name="pwd">
            </div>
            <div class="form-group">
                <label for="checkPwd">确认密码</label>
                <input type="password" id="checkPwd" class="form-control" onblur="validate()"><span id="pwdMsg"></span>
            </div>
            <div class="form-group">
                <label>性别</label>
                <label class="radio-inline">
                    <input type="radio"  value="0" name="sex">男
                </label>
                <label class="radio-inline">
                    <input type="radio"  value="1" name="sex">女
                </label>
            </div>
            <div class="form-group">
                <label for="age">年龄</label>
                <input type="text" id="age" name="age" class="form-control">
            </div>
            <button type="submit" id="subBtn" disabled>注册</button>
        </form>
    </div>
</div>
</body>
<script src="${pageContext.request.contextPath}/static/js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/js/getUserByName.js"></script>
<script>
    function validate() {
        var pwd = $("#password").val();
        var pwd1 = $("#checkPwd").val();
        <!-- 对比两次输入的密码 -->
        if(pwd == pwd1)
        {
            $("#pwdMsg").html("√");
            $("#pwdMsg").css("color","green");
            $("#subBtn").removeAttr("disabled");
        }
        else {
            $("#pwdMsg").html("密码不一致，请确认");
            $("#pwdMsg").css("color","red")
            $("#subBtn").attr("disabled","disabled");

        }

    }

</script>
</html>
